﻿<UserControl x:Class="Tfl.Controls.WPF.StationArrivalsControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:vm="clr-namespace:Tfl.Controls.WPF.ViewModel" mc:Ignorable="d" 
             FontFamily="London Tube"
             FontSize="15"
             Foreground="White"
             d:DataContext="{d:DesignInstance vm:DesignTimeStationArrivalsViewModel, IsDesignTimeCreatable=True}"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Border Background="AntiqueWhite" BorderBrush="Black" BorderThickness="2" CornerRadius="15">
            <Border.Effect>
                <DropShadowEffect ShadowDepth="6" Direction="320"></DropShadowEffect>
            </Border.Effect>
            <Grid Margin="10,10,10,10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                   <Grid Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="6*"/>
                            <ColumnDefinition Width="4*"/>
                        </Grid.ColumnDefinitions>
                        <ComboBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Column="0" ItemsSource="{Binding Path=Names}" SelectedIndex="0" SelectedValue="{Binding Path=Station}" ></ComboBox>
                        <Button Background="YellowGreen" Grid.Column="1" Command="{Binding Path=StartCommand}" >
                            <TextBlock TextAlignment="Center">Find</TextBlock>
                        </Button>
                    </Grid>
                
                <ListBox Grid.Row="1" HorizontalContentAlignment="Stretch" Background="Black" ItemsSource="{Binding Path=Times}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel  Background="{Binding Path=Color}">
                                <!--<StackPanel Orientation="Horizontal">-->
                                    <!--<TextBlock Margin="0,0,20,0" Foreground="White" Text="{Binding Path=Line}"></TextBlock>
                                    <TextBlock Foreground="White" Text="{Binding Path=Platform}"></TextBlock>-->
                                    <Expander IsExpanded="True">
                                        <Expander.Header>
                                            <StackPanel Orientation="Horizontal">
                                            <TextBlock Margin="0,0,20,0" Foreground="White" Text="{Binding Path=Line}"></TextBlock>
                                            <TextBlock Foreground="White" Text="{Binding Path=Platform}"></TextBlock>
                                            </StackPanel>
                                        </Expander.Header>
                                        <Expander.Content>
                                            <ListBox HorizontalContentAlignment="Stretch" Background="Black" ItemsSource="{Binding Path=Arrivals}">
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Grid HorizontalAlignment="Stretch">
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="*" />
                                                                <ColumnDefinition Width="Auto"/>
                                                            </Grid.ColumnDefinitions>
                                                            <TextBlock HorizontalAlignment="Stretch" Foreground="White" Text="{Binding Path=Destination}"></TextBlock>
                                                           <TextBlock HorizontalAlignment="Stretch" TextAlignment="Center" Grid.Column="1" Foreground="White" Text="{Binding Path=TimeToArrival}"></TextBlock>
                                                        </Grid>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Expander.Content>
                                    </Expander>
                                 </StackPanel>
                            <!--</StackPanel>-->
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </Border>
    </Grid>
</UserControl>
